<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>【案例】图片跟随鼠标指针移动</title>
    <style>

    </style>
</head>
<body>
    <div class="search">
        <div class="con">
            <label>快递单号：
                <input type="text" placeholder="请输入您的快递单号" class="num">
            </label>
        </div>
    </div>
<script>
    var con = document.querySelector('.con');
    var numInput = document.querySelector('.num');
    numInput.addEventListener('keyup',function (){
        if(this.value==''){
            con.style.display = 'none';
        }else {
            con.style.display = 'block';
            con.innerText = this.value;
        }
    });
    num_input.addEventListener('blur',function (){
        con.style.display = 'none';
    });
    num_input.addEventListener('focus',function (){
        con.style.display = 'block';
    })
</script>
</body>
</html>